<template>
	<view class="page">
				<cu-custom bgColor="bg-white-blue">
			<block style="font-size: 22px;" slot="content">哈密市智慧消防</block>
		</cu-custom>
		<view class="banner bg-banner"></view>
		<view class="content-box">
			<view class="my-card">
				<view class="line line-bg"></view>
				<view class="my-card-box">
					<view v-if="hasTask" >
						<view class="nocomplete">
							<text class="cuIcon-daiwancheng"></text>
							待完成任务
						</view>
						<view class="title_body">
							<text class="title">{{ task.name }}</text>
						</view>
						<view class="task-content">
							<view class="card-content">
								<text class="text-card-title">所属企业：</text>
								<text class="text-card-info">{{ task.enterpriseName }}</text>
							</view>
							<view class="card-content">
								<text class="text-card-title">执行时间：</text>
								<text class="text-card-info">{{ task.addTime }}</text>
							</view>
							<view>
								<button @click="see_detail(task.ucId)" class="cu-btn round my-btn handle" style="width: 100%;background: linear-gradient(90deg, #301FF1 3%, #301FF1 3%, #B11EF1 98%, #B11EF1 98%);">立即处理</button>
							</view>
						</view>
					</view>
					<view class="notask" v-else>
						<view class="nocomplete">
							暂无任务
						</view>
						<view class="title_body">
						</view>
					</view>
				</view>

			</view>
					<view class="u-tools">
			<view>
				<text class="tools-title">任务管理</text>
				<view class="bg-1" style="" @click="jdjc">
					<text class="tools-desc">检测任务</text>
				</view>
			</view>
		</view>
			</view>
			<message />
	</view>
</template>

<script>
	export default {
		created() {
			console.info("ahome create")

			this.getTask()

			let that = this
			uni.$on('refreshPage', function() {
				that.getTask()
			})
		},
		data() {
			return {
				hasTask: true,
				task: ''
			}
		},
		methods: {
			getTask() {
				let that = this
				let params = {
					"pageNum": 1,
					"pageSize": 1,
					"status": 1
				}
				// 请求数据
				let app = getApp()
				app.globalData.request({
					url: 'wx/examine/getInExamineTaskPage',
					data: {
						...params
					}
				}).then(function(res) {
					if (res.data.data.list.length > 0) {
						that.hasTask = true
						that.task = res.data.data.list[0]
					} else {
						that.hasTask = false
					}

				}).catch(function(e) {
					that.hasTask = false
				})
			},
			jdjc() {
				uni.navigateTo({
					url: '/jcqy/jcrw/jcrw'
				})
			},
			see_detail(ucId) {
				uni.navigateTo({
					url: '/jcqy/jcxq/jcxq?ucId=' + ucId
				})
			}
		}
	}
</script>

<style scoped>
	.page {
		height: 600px !important;
	}

	.my-btn {
		float: right;
		font-size: 24rpx;
		color: #3013F7;
		height: 50rpx;
	}


	.u-tools {
		display: flex;
		flex-direction: row;
		margin-top: 40upx;
	}

	.tools-title {
		font-size: 32rpx;
		color: #333;
		font-weight: 600;
	}

	.tools-desc {
		font-size: 20px;
		width: 100%;
		display: inline-block;
		color: #3662EC;
		margin-left: 420rpx;
		font-weight: bolder;
	}

	.u-tools view {
		flex: 1;

	}

.bg-1 {
	margin-top: 5px;
		height: 200rpx;
		border-radius: 15px;
		background-image: url("https://www.cetczhxf.com/mp3/jdjc.png");
		background-repeat: no-repeat;
		background-position: -2px 5px;
		background-size: contain;
		background-color: rgba(93, 234, 232, 0.2);
		display: flex;
		justify-content: center;
		align-items: center;
}

.bg-banner {
	background-image: url('https://www.cetczhxf.com/mp3/home_bg_jc.png');
}
</style>
